
/*
CEmitter.h
CEmitter element

*/

#pragma once
#include "Particle.h"
#include <list>
using std::list;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <iostream>
using namespace std;
#include "../tinyxml/tinyxml.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"

class CParticle;

class CEmitter :	public  CEntity
{
public:
	CEmitter(void);
	~CEmitter(void);

	list<CParticle*> m_lLive;
	list<CParticle*> m_lDead;
	list<CParticle*>::iterator m_lLiveIter;
	list<CParticle*>::iterator m_lDeadIter;
		CSGD_TextureManager*	m_pTM;
	
	void Load(void);//hardcoded load

	int counter; 
		virtual void Update( float fElapsedTime );
	virtual void Render( void );

	CParticle* Generate(void);
	void Reset(CParticle* bob);

	void SetFX(float X,float Xe,float Y,float Ye) {m_fVelXS=X;m_fVelXE=Xe;m_fVelYS=Y;m_fVelYE=Ye;}; //testing tool

private:
	//position
	int		m_nPosX;
	int		m_nPosY;

	float	m_fSpawnRate;
	float	m_fSpawncount;
	float	m_fScaleX_Start;
	float	m_fScaleX_End;
	float	m_fScaleY_Start;
	float	m_fScaleY_End;

	float	m_fColorR_Start;
	float	m_fColorR_End;
	float	m_fColorG_Start;
	float	m_fColorG_End;
	float	m_fColorB_Start;
	float	m_fColorB_End;
	float	m_fColorA_Start;
	float	m_fColorA_End;

	float	m_fVelXS; float	m_fVelXS2;
	float	m_fVelXE; float m_fVelXE2;
	float	m_fVelYS; float	m_fVelYS2; 
	float	m_fVelYE;float m_fVelYE2;

	float	m_fRotation_Start;
	float	m_fRotation_End;

	string	m_strName;

	bool	m_bLooping;

	int		m_nImageIDs;
	
	int		m_nLife_Max;
	int		m_nLife_Min;

	int		m_nMaxParticles;
	
	int		m_nSourceBlend;
	int		m_nDestBlend;
	int		m_nImageX;
	int		m_nImageY;


	RECT  m_rRECT;


public:
		void SetImageID(int X){ m_nImageIDs=X;};

		 CEmitter* LoadParticle(const char* szFileName);//,int IID);
		 int GetSBlend(void) {return m_nSourceBlend;};
		  int GetDBlend(void) {return m_nDestBlend;};
		  void SetSBlend(int S) {m_nSourceBlend=S;};
		  void SetDBlend(int D) {m_nDestBlend=D;};
};

